<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jq/jquery.js"></script>
    <script src="template-web.js"></script>
</head>
<body>

    <table>
        <thead>
            <tr>
                <th>时间</th>
                <th>温度</th>
                <th>天气</th>
                <th>风向</th>
                <th>风力</th>
            </tr>
        </thead>

        <!-- 容器 -->
        <tbody>
           
        </tbody>
    </table>
        <!-- 定义模板 -->
        <script id="mydemo" type="text/html">

            {{ each forecast_1h value index}}
            <tr>
                <td>{{ value.update_time }}</td>
                <td>{{ value.degree }}</td>
                <td>{{ value.weather }}</td>
                <td>{{ value.wind_direction }}</td>
                <td>{{ value.wind_power }}</td>
            </tr>

            {{ /each }}
        </script>

    <script>
        // https://wis.qq.com/weather/common
        // ?
        // source=pc
        // weather_type="observe|forecast_1h|forecast_24h|index|alarm|limit|tips|rise"
        // province=江苏省
        // city=南京市
        // county=
        // callback=jQuery111305898781453532551_1662534394648
        // _=1662534394650

        $.ajax({
            url:"https://wis.qq.com/weather/common",
            data:{
                source:"pc",
                weather_type:"observe|forecast_1h|forecast_24h|index|alarm|limit|tips|rise",
                province:"江苏省",
                city:"南京市",
                county:""
            },
            dataType:"jsonp",
            success:function(result){
                console.log(result);
                let str=template("mydemo",result.data);
                $("tbody").html(str);
            }
        });
    </script>
</body>
</html>